package com.bbz.core;

import com.bbz.core.map.Test;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.DoubleStream;

public class TEST {

	private static  final String aa="f";
	public static void main(String args[]) {

		String bb=aa;
		bb.hashCode();
		BigDecimal bigDecimal=new BigDecimal(0);

		// 取当前日期：
		LocalDate today = LocalDate.now();
		System.out.println(today);
		// 根据年月日取日期,月份从1开始到12   而不是java.util.date里的月份从0到11：
		LocalDate birthday = LocalDate.of(2018, 8, 13);
		long days=ChronoUnit.DAYS.between(LocalDate.now(), birthday);
		System.out.println(days);
		 List<Student> testList = new ArrayList<Student>();
		 
		 Student student=new Student();
		 student.setName("张三");
		 student.setNo("1");
		 student.setAmount(123);
		 testList.add(student);
		 Student student1=new Student();
		 student1.setName("张三");
		 student1.setNo("234");
		 student1.setAmount(123);
		 testList.add(student1);
		 Student student2=new Student();
		 student2.setName("张四");
		 student2.setNo("234");
		 student2.setAmount(123);
		 testList.add(student2);

		  List<Student> repeatList = new ArrayList<Student>();//用于存放重复的元素的list
		 
	        // 以一种方法：两个循环(最蠢的方法)
	        for (int i = 0; i < testList.size() - 1; i++) {
	            for (int j = testList.size() - 1; j > i; j--) {
	                if (testList.get(j).getName().equals(testList.get(i).getName())) {
	                    repeatList.add(testList.get(j));//把相同元素加入list(找出相同的)

	                    testList.remove(j);//删除重复元素
	                }
	            }
	        }
	      for(Student s : repeatList){
	          System.out.println("相同的元素:" + s.getName());
	      }
	      System.out.println(new Test().hashCode());
	      System.out.println("sss".hashCode());


		int i=1 << 25;
		int ii=16>>3;
		int z= 203432 & 16383;
		System.out.println(i);
		System.out.println(ii);
		System.out.println(z);


		HashMap<String,Integer> guestQuantityMap=new HashMap<>();
		guestQuantityMap.put("1",2);
		guestQuantityMap.get(2);
		 i=4;
		int j=1;
		double num =(i+j);
		System.out.println("大于" + num + "的最小数：" + Math.ceil((i+j)/2.0));
		System.out.println("小于" + num + "的最大数：" + Math.floor((i+j)/2));
		System.out.println(num + "四舍五入得到浮点数：" + Math.rint((i+j)/2));
		System.out.println(num + "四舍五入得到长整数：" + Math.round((i+j)/2.0));




		System.out.println(LocalDate.of(2018, 9, 29).plusDays(2).toString());
	}

	/**
	 * 费用
	 * 
	 * @author binbin.a.zhang
	 *
	 */
	static class  Student{
		private String name;
		private int amount;
		private String no;
		
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public int getAmount() {
			return amount;
		}
		public void setAmount(int amount) {
			this.amount = amount;
		}
		public String getNo() {
			return no;
		}
		public void setNo(String no) {
			this.no = no;
		}
	}

	public static Integer hashCode(String str, Integer multiplier) {
		int hash = 0;
		for (int i = 0; i < str.length(); i++) {
			hash = multiplier * hash + str.charAt(i);
		}
		return hash;
	}
	
}
